(function($){
    $.fn.scrollBottomPlugin = function(options){
        var _this = $(this);
        _this.defaults = {};
        _this.options = $.extend(_this.defaults, options);
        _this.scrollTop;
        _this.scrollHeight = document.body.scrollHeight;
        _this.windowHeight = document.body.clientHeight;
        _this.windowScrollTimeId;

        $(window).bind('scroll',function(){
            clearTimeout(_this.windowScrollTimeId);
            _this.windowScrollTimeId = setTimeout(_scrollBottom,200);
        }); 

        $(window).bind('resize',function(){
            _this.scrollHeight = document.body.scrollHeight;
            _this.windowHeight = document.body.clientHeight;
        }); 

        var _scrollBottom = function(){
            _this.scrollHeight = document.body.scrollHeight;
            _this.scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
            if(_this.scrollTop + _this.windowHeight >= _this.scrollHeight){
                _this.options.callbackFun();
            }
        }
        return _this;
    }
})(Zepto);